package com.example.demo;

import com.example.demo.commom.AjaxResult;
import com.example.demo.controller.UserController;
import com.example.demo.model.dto.user.RegDto;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:龙宝
 * Date:2024-05-10
 * Time:15:37
 */
@SpringBootTest
public class User {
    @Autowired
    private UserController userController;
    @Test
    public void reg(){
        RegDto regDto = new RegDto();
        regDto.setUsername("bbb");
        regDto.setPassword("123");
        AjaxResult ajaxResult = userController.reg(regDto);
        Assertions.assertTrue(ajaxResult.getCode() != 200);
    }
    @Test
    public void login(){
        RegDto regDto = new RegDto();
        regDto.setUsername("cyk");
        regDto.setPassword("123");
        AjaxResult ajaxResult = userController.login(regDto);
        Assertions.assertTrue(ajaxResult.getCode() == 200);
        System.out.println(ajaxResult.getData());
    }
}
